<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图像检索 - 跨媒体内容检索和理解系统</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        .loading-message {
            text-align: center;
            padding: 40px;
            color: #666;
        }

        .loading-message i {
            font-size: 24px;
            margin-right: 10px;
            color: #2c5cff;
        }

        .image-result-card {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            margin-bottom: 20px;
            overflow: hidden;
        }

        .image-result {
            padding: 15px;
        }

        .image-result img {
            width: 100%;
            max-height: 300px;
            object-fit: cover;
            border-radius: 4px;
        }

        .image-info {
            margin-top: 10px;
        }

        .image-title {
            font-size: 16px;
            color: #333;
            margin-bottom: 8px;
        }

        .view-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            background: #2c5cff;
            color: #fff;
            border-radius: 4px;
            text-decoration: none;
            font-size: 14px;
            transition: background 0.2s;
        }

        .view-btn:hover {
            background: #1a4aff;
        }

        /* 图片网格布局 */
        .image-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 20px;
            padding: 20px;
        }

        .image-card {
            position: relative;
            background: #fff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            transition: transform 0.2s;
        }

        .image-card:hover {
            transform: scale(1.05);
        }

        .image-card img {
            width: 100%;
            height: 200px;
            object-fit: cover;
            display: block;
        }

        .image-actions {
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            width: 90%;
            display: flex;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .image-card:hover .image-actions {
            opacity: 1;
        }

        .download-btn {
            background: #2c5cff;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            transition: background 0.2s;
        }

        .download-btn:hover {
            background: #1a4aff;
        }

        .download-btn i {
            font-size: 16px;
        }

        /* 加载状态和错误提示 */
        .loading-message, .no-results, .error-message {
            text-align: center;
            padding: 40px;
            color: #666;
        }

        .loading-message i, .no-results i, .error-message i {
            font-size: 24px;
            margin-right: 10px;
            color: #2c5cff;
        }

        /* 功能特点展示样式 */
        .search-features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .feature-card {
            background: #f8fafc;
            padding: 20px;
            border-radius: 12px;
            border: 1px solid #e2e8f0;
            transition: all 0.3s;
        }

        .feature-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }

        .feature-card i {
            font-size: 24px;
            color: #4299e1;
            margin-bottom: 12px;
        }

        .feature-card h3 {
            font-size: 18px;
            color: #2d3748;
            margin-bottom: 8px;
        }

        .feature-card p {
            color: #718096;
            font-size: 14px;
            line-height: 1.6;
        }

        /* 使用指南样式 */
        .usage-guide {
            background: linear-gradient(135deg, #ebf8ff 0%, #e6fffa 100%);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 24px;
        }

        .guide-steps {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
            margin-top: 12px;
        }

        .step-item {
            background: white;
            padding: 16px;
            border-radius: 8px;
            display: flex;
            gap: 12px;
            align-items: flex-start;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .step-number {
            background: #4299e1;
            color: white;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            flex-shrink: 0;
        }

        .step-content h4 {
            color: #2d3748;
            margin-bottom: 4px;
            font-size: 16px;
        }

        .step-content p {
            color: #718096;
            font-size: 14px;
            line-height: 1.5;
        }

        /* 图片质量提示 */
        .quality-tips {
            background: #fffbeb;
            border-radius: 12px;
            padding: 16px;
            margin: 20px 0;
            border-left: 4px solid #f6ad55;
        }

        .quality-tips h4 {
            color: #744210;
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }

        .quality-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 12px;
            margin-top: 12px;
        }

        .quality-item {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #975a16;
            font-size: 14px;
        }

        /* 检索统计信息 */
        .search-stats {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #f8fafc;
            padding: 16px;
            border-radius: 12px;
            margin: 24px 0;
        }

        .stats-item {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #4a5568;
            font-size: 14px;
        }

        .stats-item i {
            color: #4299e1;
        }

        /* 上传区域美化 */
        .image-upload {
            border: 2px dashed #e2e8f0;
            background: #f8fafc;
            padding: 40px;
            border-radius: 12px;
            text-align: center;
            transition: all 0.3s;
            margin-bottom: 24px;
        }

        .image-upload:hover {
            border-color: #4299e1;
            background: #ebf8ff;
        }

        .upload-icon {
            font-size: 48px;
            color: #4299e1;
            margin-bottom: 16px;
        }

        /* 处理进度指示器 */
        .process-indicator {
            position: fixed;
            bottom: 24px;
            right: 24px;
            background: white;
            padding: 12px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 1000;
            display: none;
        }

        .process-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #4299e1;
            animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); opacity: 1; }
            50% { transform: scale(1.5); opacity: 0.5; }
            100% { transform: scale(1); opacity: 1; }
        }

        /* 结果展示优化 */
        .result-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 24px;
        }

        .result-card {
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            transition: transform 0.3s;
        }

        .result-card:hover {
            transform: translateY(-4px);
        }

        .result-image {
            position: relative;
            padding-top: 75%;
            overflow: hidden;
        }

        .result-image img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .result-info {
            padding: 16px;
        }

        .result-actions {
            display: flex;
            justify-content: flex-end;
            padding: 12px;
            background: #f8fafc;
            gap: 8px;
        }

        .action-btn {
            padding: 8px 16px;
            border-radius: 6px;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .download-btn {
            background: #4299e1;
            color: white;
            border: none;
        }

        .download-btn:hover {
            background: #3182ce;
        }
    </style>
</head>
<body>
    <div class="layout">
        <!-- 侧边栏导航 -->
        <div class="sidebar">
            <div class="logo">
                <span>跨媒体内容检索和理解系统</span>
            </div>
            <nav class="nav-menu">
                <a href="text-search.html" class="nav-item" data-type="text">文本检索</a>
                <a href="audio-search.html" class="nav-item" data-type="audio">语音检索</a>
                <a href="image-search.html" class="nav-item" data-type="image">图像内容理解</a>
                <a href="image-retrieval.html" class="nav-item active" data-type="image-retrieval">图像检索</a>
                <a href="video-search.html" class="nav-item" data-type="video">视频检索</a>
            </nav>
        </div>

        <!-- 主要内容区 -->
        <div class="main-content">
            <div class="search-section">
                <h2><i class="fas fa-images"></i> 图像检索</h2>

                <!-- 添加功能特点展示 -->
                <div class="search-features">
                    <div class="feature-card">
                        <i class="fas fa-search-plus"></i>
                        <h3>相似图像检索</h3>
                        <p>基于深度特征的图像匹配，快速找到相似内容</p>
                    </div>
                    <div class="feature-card">
                        <i class="fas fa-th"></i>
                        <h3>多维度匹配</h3>
                        <p>从颜色、纹理到语义的全方位图像对比</p>
                    </div>
                    <div class="feature-card">
                        <i class="fas fa-tachometer-alt"></i>
                        <h3>实时响应</h3>
                        <p>优化的检索算法，毫秒级响应速度</p>
                    </div>
                </div>

                <!-- 使用指南 -->
                <div class="usage-guide">
                    <h3><i class="fas fa-book-reader"></i> 使用指南</h3>
                    <div class="guide-steps">
                        <div class="step-item">
                            <div class="step-number">1</div>
                            <div class="step-content">
                                <h4>上传图片</h4>
                                <p>选择或拖拽图片到上传区域</p>
                            </div>
                        </div>
                        <div class="step-item">
                            <div class="step-number">2</div>
                            <div class="step-content">
                                <h4>确认预览</h4>
                                <p>检查图片是否清晰完整</p>
                            </div>
                        </div>
                        <div class="step-item">
                            <div class="step-number">3</div>
                            <div class="step-content">
                                <h4>开始检索</h4>
                                <p>点击检索按钮开始搜索相似图片</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 图片质量提示 -->
                <div class="quality-tips">
                    <h4><i class="fas fa-lightbulb"></i> 图片质量建议</h4>
                    <div class="quality-list">
                        <div class="quality-item">
                            <i class="fas fa-check-circle"></i>
                            <span>清晰度不低于 720p</span>
                        </div>
                        <div class="quality-item">
                            <i class="fas fa-check-circle"></i>
                            <span>光线充足均匀</span>
                        </div>
                        <div class="quality-item">
                            <i class="fas fa-check-circle"></i>
                            <span>主体突出清晰</span>
                        </div>
                        <div class="quality-item">
                            <i class="fas fa-check-circle"></i>
                            <span>避免严重模糊</span>
                        </div>
                    </div>
                </div>

                <!-- 检索统计信息 -->
                <div class="search-stats">
                    <div class="stats-item">
                        <i class="fas fa-database"></i>
                        <span>图库容量：1,000,000+</span>
                    </div>
                    <div class="stats-item">
                        <i class="fas fa-bolt"></i>
                        <span>平均响应：0.5s</span>
                    </div>
                    <div class="stats-item">
                        <i class="fas fa-chart-line"></i>
                        <span>检索准确率：95%+</span>
                    </div>
                </div>

                <div class="image-search-container">
                    <!-- 图片上传区域 -->
                    <div class="image-upload">
                        <input type="file" id="image-file" accept="image/*" style="display: none;">
                        <label for="image-file">
                            <i class="fas fa-cloud-upload-alt upload-icon"></i>
                            <div class="upload-text">点击上传图片或拖拽至此</div>
                            <p class="upload-hint">支持 JPG、PNG、JPEG 等常见图片格式</p>
                        </label>
                    </div>

                    <!-- 图片预览 -->
                    <div class="image-preview" style="display: none;">
                        <img id="preview" src="" alt="预览图片">
                    </div>

                    <!-- 检索按钮 -->
                    <div class="search-actions">
                        <button class="search-btn" disabled>
                            <i class="fas fa-search"></i>
                            开始检索图片
                        </button>
                    </div>

                    <!-- 检索结果显示区域 -->
                    <div class="result-cards">
                        <!-- 结果卡片将通过JavaScript动态添加 -->
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 处理进度指示器 -->
    <div class="process-indicator">
        <div class="process-dot"></div>
        <span>正在检索相似图片...</span>
    </div>

    <script src="image-retrieval.js"></script>
</body>
</html> 